﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UtilityLibrary.WinControls;

namespace WL_WinForm
{
    public partial class FrmMainTool : WeifenLuo.WinFormsUI.Docking.DockContent
    {
        private OutlookBar outlookBar1 = null;

        public FrmMainTool()
        {
            InitializeComponent();
            Init();
        }

        private void Init()
        {
            outlookBar1 = new OutlookBar();

            #region 页面管理
            OutlookBarBand outlookShortcutsBand = new OutlookBarBand("后台管理");
            outlookShortcutsBand.SmallImageList = imageList1;
            outlookShortcutsBand.LargeImageList = this.imageList1;
            outlookShortcutsBand.Items.Add(new OutlookBarItem("网站实例",0));
            outlookShortcutsBand.Items.Add(new OutlookBarItem("文章管理",1));
            outlookShortcutsBand.Items.Add(new OutlookBarItem("留言管理", 2));
            outlookShortcutsBand.Items.Add(new OutlookBarItem("分类管理", 3));
            outlookShortcutsBand.Background = SystemColors.AppWorkspace;
            outlookShortcutsBand.TextColor = Color.White;
            outlookBar1.Bands.Add(outlookShortcutsBand);

            #endregion

            #region 管理员
            OutlookBarBand outlookShortcutsBand1 = new OutlookBarBand("管理员");
            outlookShortcutsBand1.SmallImageList = imageList1;
            outlookShortcutsBand1.LargeImageList = this.imageList1;
            outlookShortcutsBand1.Items.Add(new OutlookBarItem("用户管理", 4));
            outlookShortcutsBand1.Items.Add(new OutlookBarItem("权限类型", 5));
            outlookShortcutsBand1.Background = SystemColors.AppWorkspace;
            outlookShortcutsBand1.TextColor = Color.White;
            outlookBar1.Bands.Add(outlookShortcutsBand1);

            #endregion

            outlookBar1.Dock = DockStyle.Fill;
            outlookBar1.SetCurrentBand(0);
            outlookBar1.ItemClicked += new OutlookBarItemClickedHandler(OnOutlookBarItemClicked);
            outlookBar1.ItemDropped += new OutlookBarItemDroppedHandler(OnOutlookBarItemDropped);

            this.Controls.AddRange(new Control[] { outlookBar1 });

        }

        private void OnOutlookBarItemClicked(OutlookBarBand band, OutlookBarItem item)
        {
            switch (item.Text)
            {
                case "网站实例":
                    FrmMain.frmMain.ShowContent("网站实例", typeof(WebEx));
                    break;
                case "文章管理":
                    FrmMain.frmMain.ShowContent("文章管理", typeof(Article));
                    break;
                case "留言管理":
                    FrmMain.frmMain.ShowContent("留言管理", typeof(FrmNote));
                    break;
                case "用户管理":
                    FrmMain.frmMain.ShowContent("用户管理", typeof(Admin));
                    break;
                case "分类管理":
                    FrmMain.frmMain.ShowContent("分类管理", typeof(FrmCategory));
                    break;
                case "权限类型":
                    FrmMain.frmMain.ShowContent("权限管理", typeof(FrmPurview));
                    break;
                default:
                    break;
            }
        }

        private void OnOutlookBarItemDropped(OutlookBarBand band, OutlookBarItem item)
        {
         
        }

        private void FrmMainTool_Load(object sender, EventArgs e)
        {

        }
    }
}
